package com.ruoyi.jeeplus.modules.screen.screen_mqtt_pv_data.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.jeeplus.modules.screen.screen_mqtt_pv_data.domain.mqtt_pv_data;
import com.ruoyi.jeeplus.modules.screen.screen_mqtt_pv_data.service.Imqtt_pv_dataService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 存储MQTT光伏发电Controller
 * 
 * @author ruoyi
 * @date 2024-11-07
 */
@RestController
@RequestMapping("/screen_mqtt_pv_data/mqtt_pv_data")
public class mqtt_pv_dataController extends BaseController
{
    @Autowired
    private Imqtt_pv_dataService mqtt_pv_dataService;

    /**
     * 查询存储MQTT光伏发电列表
     */
    @PreAuthorize("@ss.hasPermi('screen_mqtt_pv_data:mqtt_pv_data:list')")
    @GetMapping("/list")
    public TableDataInfo list(mqtt_pv_data mqtt_pv_data)
    {
        startPage();
        List<mqtt_pv_data> list = mqtt_pv_dataService.selectmqtt_pv_dataList(mqtt_pv_data);
        return getDataTable(list);
    }

    /**
     * 导出存储MQTT光伏发电列表
     */
    @PreAuthorize("@ss.hasPermi('screen_mqtt_pv_data:mqtt_pv_data:export')")
    @Log(title = "存储MQTT光伏发电", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, mqtt_pv_data mqtt_pv_data)
    {
        List<mqtt_pv_data> list = mqtt_pv_dataService.selectmqtt_pv_dataList(mqtt_pv_data);
        ExcelUtil<mqtt_pv_data> util = new ExcelUtil<mqtt_pv_data>(mqtt_pv_data.class);
        util.exportExcel(response, list, "存储MQTT光伏发电数据");
    }

    /**
     * 获取存储MQTT光伏发电详细信息
     */
    @PreAuthorize("@ss.hasPermi('screen_mqtt_pv_data:mqtt_pv_data:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(mqtt_pv_dataService.selectmqtt_pv_dataById(id));
    }

    /**
     * 新增存储MQTT光伏发电
     */
    @PreAuthorize("@ss.hasPermi('screen_mqtt_pv_data:mqtt_pv_data:add')")
    @Log(title = "存储MQTT光伏发电", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody mqtt_pv_data mqtt_pv_data)
    {
        return toAjax(mqtt_pv_dataService.insertmqtt_pv_data(mqtt_pv_data));
    }

    /**
     * 修改存储MQTT光伏发电
     */
    @PreAuthorize("@ss.hasPermi('screen_mqtt_pv_data:mqtt_pv_data:edit')")
    @Log(title = "存储MQTT光伏发电", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody mqtt_pv_data mqtt_pv_data)
    {
        return toAjax(mqtt_pv_dataService.updatemqtt_pv_data(mqtt_pv_data));
    }

    /**
     * 删除存储MQTT光伏发电
     */
    @PreAuthorize("@ss.hasPermi('screen_mqtt_pv_data:mqtt_pv_data:remove')")
    @Log(title = "存储MQTT光伏发电", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(mqtt_pv_dataService.deletemqtt_pv_dataByIds(ids));
    }
}
